using System;

namespace SeataNet.Core.Saga
{
    /// <summary>
    /// Saga动作属性 - 标记Saga的动作方法
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class SagaActionAttribute : Attribute
    {
        /// <summary>
        /// 动作名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 补偿方法名称
        /// </summary>
        public string CompensationMethod { get; set; }

        public SagaActionAttribute(string name = null, string compensationMethod = null)
        {
            Name = name;
            CompensationMethod = compensationMethod;
        }
    }

    /// <summary>
    /// GlobalTransactionalConfirm 属性 - 标记Saga的确认方法
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class GlobalTransactionalConfirmAttribute : Attribute
    {
        /// <summary>
        /// 方法名称
        /// </summary>
        public string Name { get; set; }

        public GlobalTransactionalConfirmAttribute(string name = null)
        {
            Name = name;
        }
    }

    /// <summary>
    /// GlobalTransactionalCompensation 属性 - 标记Saga的补偿方法
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class GlobalTransactionalCompensationAttribute : Attribute
    {
        /// <summary>
        /// 方法名称
        /// </summary>
        public string Name { get; set; }

        public GlobalTransactionalCompensationAttribute(string name = null)
        {
            Name = name;
        }
    }

    /// <summary>
    /// GlobalTransactionalCancel 属性 - 标记Saga的取消方法
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class GlobalTransactionalCancelAttribute : Attribute
    {
        /// <summary>
        /// 方法名称
        /// </summary>
        public string Name { get; set; }

        public GlobalTransactionalCancelAttribute(string name = null)
        {
            Name = name;
        }
    }
}
